// 供应商管理

import axios from "@/api/axios";

// let organizationNo = sessionStorage.getItem("organizationNo")
export default {
  // 获取客户列表
  queryPageByCondition(params) {
    params.entity.organizationNo = sessionStorage.organizationNo;
    return axios.post("/v3/purchase/supplier/queryPageByCondition", params)
  },
  // 新增
  add(params) {
    return axios.post("/v3/purchase/supplier/add", {
      ...params,
      organizationNo: sessionStorage.organizationNo
    })
  },
  // 修改
  edit(params) {
    return axios.post("/v3/purchase/supplier/edit", params)
  },
  // 修改
  editMaterial(params) {
    return axios.post("/v3/purchase/supplierMaterialConfig/edit", params)
  },
  // 批量删除
  delList(noList) {
    return axios.post(`/v3/purchase/supplier/delListByNo`, { noList: noList })
  },
  // 根据编号查询
  queryByNo(no) {
    return axios.get(`/v3/purchase/supplier/queryByNo?no=${no}`)
  },
  // 查询图片
  getImgByNo(no) {
    return axios.get(`/v3/purchase/businessLicensePicture/queryByNo?no=${no}`)
  },
  // 删除图片
  delImgByNo(no) {
    return axios.get(`/v3/purchase/businessLicensePicture/delByNo?no=${no}`)
  },
  queryBySupplierNo(no) {
    return axios.get(`/v3/purchase/supplierMaterialConfig/queryBySupplierNo?supplierNo=${no}`)
  },
  // 条件查询
  queryByCondition(params) {
    params.organizationNo = sessionStorage.organizationNo;
    return axios.post("/v3/purchase/supplier/queryByCondition", params)
  },

  // // 获取供应商
  getSupplierList(param) {
    return axios.post("/supplier/queryPageList", param)
  },
  // 添加供应商信息
  addSupplierinfo(formData) {
    formData.organizationNo = sessionStorage.organizationNo
    return axios.post("/supplier/add", formData);
  },
  // 修改供应商信息
  editSupplierinfo(formData) {
    return axios.post("/supplier/edit", formData);
  },
  // 查詢供应商名稱
  supplierName() {
    return axios.post("/v3/purchase/supplier/find", {
      entity: {
        organizationNo: sessionStorage.organizationNo
      }
    })
  },
  // 批量刪除
  delSupplierinfo(list) {
    return axios.post("/supplier/delList", { supplierIdList: list });
  },
  // 刪除
  delGetSupplierinfo(supplierId) {
    return axios.get(`/supplier/del/${supplierId}`);
  }
}
